package jhelper_homework04;

/**
 *
 * @author 2010405121 朱荻
 */
public class JavaHomeWork {

    public static void main(String[] args) {
        String mobile = "15078812529";
        boolean flag = true;
        if (mobile.length() != 11) {
            flag = false;
        }
        if (!(mobile.startsWith("13") || mobile.startsWith("15"))) {
            flag = false;
        }
        String numstr = "0123456789";
        for (int i = 0; i < mobile.length(); i++) {
            char c = mobile.charAt(i);
            int temp = numstr.indexOf(c);
            if (temp < 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            System.out.println("合法手机号码！");
        } else {
            System.out.println("不合法手机号码！");
        }
    }
}
